<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加用户</title>
<script type="text/javascript">
	function method01(){
		 var spannameElement = document.getElementById('usernameerror');
		 spannameElement.innerHTML='<font color="red">* 用户名在4~11位</font>';
		 var spanpasswordElement = document.getElementById('userpassworderror');
		 spanpasswordElement.innerHTML='<font color="red">* 密码在6~14位</font>';
		 var usernameElement = document.getElementsByName('user_name');
	     var uesrnamecontent = usernameElement[0].value;
	     if(!(uesrnamecontent!=null&&uesrnamecontent.length>=4&&uesrnamecontent.length<=11)){
	    	 spannameElement.innerHTML='<font color="red">用户名错误！</font>'
	         return;
	     }   
	     var userpasswordElement = document.getElementsByName('user_password');
	     var userpasswordcontent = userpasswordElement[0].value;
	     if(!(userpasswordcontent!=null&&userpasswordcontent.length>=6&&userpasswordcontent.length<=14)){
	          spanpasswordElement.innerHTML='<font color="red">密码错误！</font>'
	          return;
	     }
	     var formElement = document.getElementById('myform');
	        formElement.action='${pageContext.request.contextPath }/servlet/adduserservlet';
	        formElement.method='post';
	        formElement.submit();
	}
</script>
</head>
<body>
<form id="myform">
  用户名：<input type="text" name="user_name"><span id="usernameerror"><font color="red">* 用户名在4~11位</font></span><br>
  密  码：<input type="password" name="user_password"><span id="userpassworderror"><font color="red">* 密码在6~14位</font></span><br>
  部  门：
  <select name="select_dept">
      <option >==请选择==</option>
      <c:forEach var="dept" items="${deptInfo}">
          <option value=${dept.deptName}>${dept.deptName}</option>
      </c:forEach>
  </select><br>
  描  述：<input type="text" name="user_desc"><br>
  状态：<input type="radio" name="user_flag" value="1" checked="checked"> 启用
     <input type="radio" name="user_flag" value="0"> 禁用<br>
<input type="button" value="提交" onclick="method01()">
<input type="reset" value="重置">
</form>
</body>
</html>